The current user ('%1!s!') either does not have permission to access the database specified in the parameter @execute_query_database ...

The current user ('%1!s!') either does not have permission to access the database specified in the parameter @execute_query_database or cannot impersonate the user specified in the parameter @execute_query_as. Only members of the sysadmin fixed server role and members of the db_owner fixed database role can impersonate another user.