Locked out of sa because nobody remembers the password, or inherited a server where it was never documented? If you have local Administrator access on the box, you can reset it in a couple of minutes — SQL Server lets the local Administrators group connect as a sysadmin by default (member of the built-in Builtin\Administrators login on default installs).
Still true today: this only works if the server is in mixed mode (SQL Server and Windows Authentication). If it is Windows-authentication-only, enable mixed mode first.
Reset via SSMS (GUI)
- Open SQL Server Management Studio and connect using Windows Authentication.
- Right-click the server name, choose Properties.
- On the Security page, set server authentication to SQL Server and Windows Authentication mode, click OK, and restart the SQL Server service.
- Expand Security → Logins, right-click sa, open Properties.
- Set the new password on the General page, and on the Status page set the login to Enabled.
- Restart the service again so the authentication-mode change takes effect (changing the password itself needs no restart).
Reset via T-SQL (preferred)
The modern, supported way is ALTER LOGIN — works from SSMS, sqlcmd, or any client:
USE [master];
GO
ALTER LOGIN [sa] WITH DEFAULT_DATABASE = [master],
DEFAULT_LANGUAGE = [us_english],
CHECK_EXPIRATION = ON, CHECK_POLICY = ON;
GO
ALTER LOGIN [sa] WITH PASSWORD = N'<new-password>' MUST_CHANGE;
GO
ALTER LOGIN [sa] ENABLE;
GO
MUST_CHANGE forces a password change at the next login — drop that clause if you want to log in as sa immediately with the new password. CHECK_POLICY validates the password against the Windows password policy of the host.
Reset from the command line
If SSMS is not available, sqlcmd does the same job (use -E for a trusted connection):
sqlcmd -S <server> -E
1> ALTER LOGIN [sa] WITH PASSWORD = N'<new-password>';
2> GO
Deprecation note
Older guides (including the original version of this post) used EXEC sp_password NULL, '<new-password>', 'sa' from the osql prompt. That stored procedure has been deprecated for many years — Microsoft’s documentation states it will be removed in a future version and to use ALTER LOGIN instead. Also note osql itself was retired in favor of sqlcmd after SQL Server 2005.
A better idea in 2026
If you find yourself resetting sa because it is the only login you have, fix the root cause instead: leave sa disabled (it is disabled by default on modern installs), keep at least two named sysadmin logins documented in your password manager, and connect administrators through their own accounts rather than a shared login. For automation, prefer least-privilege logins with db_datareader/db_datawriter plus explicit grants — not another copy of sysadmin.