Grant Server State attribute to user

GRANT VIEW SERVER STATE TO codeQuery

Grant Execute for a Stored Procedure for a User

GRANT EXECUTE ON [sp_GetsAMAccount] TO [ADautmationAccountInMaster] 

x