Stored Procedures

I have three developers and due to regulatory requirements I need to keep all stored procedures on our live system as read only.  They have full ownership in the development and pilot environments.  

Is there a simple way to allow the developers read only access for stored procedures in the production database?

I gave them execute this allows them to run the sp but not open and view it.

We are on MS SQL 2005.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Deepak ChauhanSQL Server DBACommented:
So far i understood , you have given the Execute permission on stored procedure to those three users, and now you want they can view the code written inside the SP but not able to modify. I am right here,  

grant view definition on <sp> to <user>

or you can grant view definition permission on complete schema like Tables and SP etc.... This way they can view all objects script but can not modify.

grant view definition on <schema>::DBO to <user>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Vitor MontalvãoMSSQL Senior EngineerCommented:
You can use the following command to allow an user to view all database objects (table, views, stored procedures, etc...) without giving them permission to execute or see the data:

Open in new window

Or if you want to only allow for a specific object:

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.