How to grant view permissions on all stored procedures in SQL Server

SQL-Server

You can use the T-SQL code below within your database to give permissions to 'MYUSER' for viewing all stored procedures. (Of course, replace "MYUSER" with your own user.)

Once executed, you can copy and paste the output to a new query window and execute it.

select 'GRANT VIEW DEFINITION ON ' + quotename(specific_schema) 
+ '.' + quotename(specific_name)
+ ' TO ' + 'MYUSER'
  from INFORMATION_SCHEMA.routines
where routine_type = 'PROCEDURE'