migrating legacy databases from SQL Server 2000 via SQL Server 2008 to SQL Server 2012: users and logins
You can use the following to list orphaned sql users:

USE foo
go

EXEC sp_change_users_login 'Report';


and 

USE foo
go

EXEC sp_change_users_login 'update_one', 'foouser', 'foouser';


to fix each one.