SQL Server sp_addrolemember in stored procedure for different database
EXEC('USE mydb;ALTER ROLE myRole ADD MEMBER myMember;');


But I am not quite sure what you are trying to achieve. After restoring a database to a different server, you need to fix the link between users and logins. For that you can execute this in your database:

ALTER USER myUser WITH LOGIN myLogin;


Or use the same EXEC('USE...') method shown above with that ALTER USER statement. That should get you where you need to be. All the database related permissions are stored in the database itself, so they get restored with the database.