Sunday, March 17, 2013

How to protect My Stored Procedure Code.

When deploying applications to a client's server(s) or to a shared SQL Server, there is often a concern that other people might peek at your business logic. Since often the code in a stored procedure can be proprietary, it is understandable that we might want to protect our T-SQL work. Use "WITH ENCRYPTION" option to protect your SQL code as shown below.

CREATE PROCEDURE dbo.Manvendra
WITH ENCRYPTION
AS
BEGIN
SELECT 'SQL statements'
END
 
Now when you will try to run sp_helptext to see the code, below error will appear.

"The text for object 'Manvendra' is encrypted"

No comments: