This is used for moving the database files from one server to another or whenever similar identity elements are changed.
USE GridTrak EXEC sp_grantlogin 'NT AUTHORITY\NETWORK SERVICE' EXEC sp_grantdbaccess 'NT AUTHORITY\NETWORK SERVICE' EXEC sp_grantlogin 'IIS APPPOOL\ASP.NET v4.0' EXEC sp_grantdbaccess 'IIS APPPOOL\ASP.NET v4.0'
You can also use the sp_grantlogin and sp_grantdbaccess procedures to grant access for User logins.