Here’s some handy SQL to alter the login of an existing user via a query. I recently lost my login to one of the databases I use for a project (OK, I didn’t lose it, I forgot it). Luckily I had another account I could login to the database with via SQL Server Management Studio, and execute the below query to reset the password of the one that I forgot.
This got me out of a bind:
GO ALTER LOGIN [login_name] WITH DEFAULT_DATABASE=[database_name] GO USE [database_name] GO ALTER LOGIN [login_name] WITH PASSWORD=N'new_password' MUST_CHANGE GO