title: MS SQL Server: Check to see if a user can execute a stored procedure
body: <p>How can you check to see if a user can execute a stored procedure in MS SQL server?</p>
  
  <p>I can see if the user has explicit execute permissions by connecting to the master database and executing:</p>
  
  <pre><code>databasename..sp_helpprotect 'storedProcedureName', 'username'
  </code></pre>
  
  <p>however if the user is a member of a role that has execute permissions sp_helprotect won't help me.</p>
  
  <p>Ideally I'd like to be able to call something like </p>
  
  <pre><code>databasename..sp_canexecute 'storedProcedureName', 'username'
  </code></pre>
  
  <p>which would return a bool.</p>