As the title states “Error 15023: User or role ‘<name>’ already exists in the current database.” This usually happens after you have restored a database from a backup from one server to another.
I used to use sp_change_users_login. According to Microsoft on this link about its usage, it will be removed in the future versions of SQL Server. http://tinyurl.com/y9ftnpx. It does not say when in the future. I have used it many times on SQL Server 2005 and recently on SS 2008. So for now it still works.
Microsoft states you should use ALTER_USER instead. http://tinyurl.com/yg8g4vq
Both of these stored procedures basically do the same thing. Map existing database users to SQL server logins.
Since we are advised “not” to use sp_change_users_login I am not going to describe it further.
ALTER_USER-Renames a database user or changes its default schema.
userName: name of the user inside the database.
Remaps a user to another login by changing the Security Identifier (SID)
The new name for the user, this name cannot already exist in the database.
This indicates the first schema that will be searched by the server when trying to resolve the names of the objects for the user.
Leaving the default_schema undefined will assign the dbo schema b default.
ALTER USER User1 WITH NAME = User2;
Hope this helps. Be sure to follow the link above to get more details.