<p>How do I determine using TSQL what roles are granted execute permissions on a specific stored procedure? Is there a system stored procedure or a system view I can use?</p>

[{'answer_id': 67417, 'author': 'palehorse', 'author_id': 312, 'author_profile': 'https://Stackoverflow.com/users/312', 'pm_score': 0, 'selected': False, 'text': "<p>You can try something like this.  Note, I believe 3 is EXECUTE.</p>\n\n<pre><code>SELECT\ngrantee_principal.name AS [Grantee],\nCASE grantee_principal.type WHEN 'R' THEN 3 WHEN 'A' THEN 4 ELSE 2 END - CASE 'database' WHEN  'database' THEN 0 ELSE 2 END AS [GranteeType]\nFROM\nsys.all_objects AS sp\nINNER JOIN sys.database_permissions AS prmssn ON prmssn.major_id=sp.object_id AND prmssn.minor_id=0 AND prmssn.class=1\nINNER JOIN sys.database_principals AS grantee_principal ON grantee_principal.principal_id = prmssn.grantee_principal_id\nWHERE\n(sp.type = N'P' OR sp.type = N'RF' OR sp.type='PC')and(sp.name=N'myProcedure' and SCHEMA_N\n</code></pre>\n\n<p>I got that example by simply using SQL Profiler while looking at the permissions on a procedure.  I hope that helps.</p>\n"}, {'answer_id': 70078, 'author': 'Jonathan', 'author_id': 6910, 'author_profile': 'https://Stackoverflow.com/users/6910', 'pm_score': 1, 'selected': False, 'text': "<p>In 7.0 or 2000, you can modify and use the following code:</p>\n\n<pre><code>SELECT convert(varchar(100),\n        'GRANT ' +\n        CASE         WHEN actadd &amp; 32 = 32 THEN 'EXECUTE'\n                ELSE\n                        CASE WHEN actadd &amp; 1 = 1   THEN 'SELECT' + CASE WHEN actadd &amp; (8|2|16) &gt; 0  THEN ', ' ELSE '' END ELSE '' END +\n                        CASE WHEN actadd &amp; 8 = 8   THEN 'INSERT' + CASE WHEN actadd &amp; (2|16) &gt; 0  THEN ', ' ELSE '' END ELSE '' END +\n                        CASE WHEN actadd &amp; 2 = 2   THEN 'UPDATE' + CASE WHEN actadd &amp; (16) &gt; 0  THEN ', ' ELSE '' END ELSE '' END +\n                        CASE WHEN actadd &amp; 16 = 16 THEN 'DELETE' ELSE '' END\n        END + ' ON [' + o.name + '] TO [' + u.name + ']') AS '--Permissions--'\nFROM syspermissions p\nINNER JOIN sysusers u ON u.uid = p.grantee\nINNER JOIN sysobjects o ON p.id = o.id\nWHERE o.type &lt;&gt; 'S'\nAND o.name NOT LIKE 'dt%'\n--AND o.name = '&lt;specific procedure/table&gt;'\n--AND u.name = '&lt;specific user&gt;'\nORDER BY u.name, o.name \n</code></pre>\n"}]
['https://Stackoverflow.com/questions/67244', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4872/']