Categories
Sql Server

How To Encrypt Stored Procedure In SQL Server

How To Encrypt Stored Procedure In SQL Server

Hi,Guys in this tutorial i will explain you how to create a Encrypted Stored Procedure in SQL Server.
Sometime we have a business logics and we want to hide the logic implementation then the schema of the stored procedure can be encrypted.

Code:-

CREATE PROCEDURE SP_EncryptedStoredPROC
WITH ENCRYPTION
AS
BEGIN
SET NOCOUNT ON
SELECT *   FROM dbo.emp      
END

After Running the above query it will create the procedure.Now run the following query.

sp_helptext SP_EncryptedStoredPROC

And It will show you the following message instead of Logic contained by Stored Procedure.

The text for object ‘SP_EncryptedStoredPROC’ is encrypted.

Enjoy….