To stop the user SID's mismatch in SQL Server 2005 for databases that are continually moved and restored from one database server to another
Run a script to collect the current sid of the user after a user database has been restored
username = bennett
SELECT sid FROM sysusers WHERE name = 'bennett';
Then create a server login. Use the SID from the above query output and replace the username and password with the relevant details.
CREATE LOGIN [bennett]
WITH PASSWORD = 'Ax$ef6!f', SID = 0xA2AE403E43ED084C8B3021E7E8DFD61C,
CHECK_POLICY = OFF, CHECK_EXPIRATION = OFF;
Then create a database user for bennett, with the default schema dbo.
CREATE USER [bennett] FOR LOGIN [bennett]
WITH DEFAULT_SCHEMA = dbo;
When you restore the database again the database user continues to work with no further action required.