Monthly Archives: May 2014 - Page 6

Encrypting SQL Stored Procedures

 

How to encrypt a SP?

Using WITH ENCRYPTION keyword as below:

 

[cc lang="SQL"]

CREATE PROCEDURE uspPersons WITH ENCRYPTION
AS
SELECT * FROM person.contact
GO

[/cc]

If we try to view using the system stored procedure like sp_helptext it will shout “objects have been encrypted”.

How to decrypt?

Alter the proc without the “WITH ENCRYPTION” key word.

 

[cc lang="SQL"]

CREATE PROCEDURE uspPersons
AS
SELECT * FROM person.contact
GO

[/cc]