Introduction
Today we are going to learn how to encrypt the logic of a Stored Procedure from the end user or others. There are several reasons to hide the logic of a Stored Procedure. The most important reason is security. We encrypt the Stored Procedure using the "with encryption" keyword.
I assume you have basic knowledge of Stored Procedures. For more help visit, Stored Procedure in SQL Server.
First of all we create a table named student. After that we create a Stored Procedure named usp_details without encryption then we show the logic of that Stored Procedure with the help of command. After that we create another encrypted Stored Procedure named usp_details1. And show that we can't see the logic of the encrypted Stored Procedure.
Creation of table:
create table student(studentId int, studentName Varchar(15), studentAdd varchar(25))
Insertion of data:
insert into student
select 1,'Deepak','Delhi'union all
select 2,'Arora','Punjab'union all
select 3,'Ashu','tarapur'
Output:
select * from student

Creation of unencrypted Stored Procedure:





Ravi SatyadarshiPosted May 15, 2014, 7:50 AM
@Vinay Kumar, You will have to take a backup of that sp before encrypting and deploying in production server.
viji lalPosted Nov 30, 2012, 1:35 AM
Thank YOU Very much mr.Georige..
Deepak MiddhaPosted Nov 27, 2012, 5:13 AM
Thanks Georige..
Georgie WebberPosted Nov 27, 2012, 2:25 AM
Very nice and useful article for security.
sarath kumarPosted Nov 21, 2012, 3:24 AM
Nice
vinay kumarPosted Nov 17, 2012, 6:17 AM
Hai Good Evening Very Useful topic i have one doubt in future i want changes on that stored procedure how can i do this.... Thanks & Regards P.vinay Kumar
Ravi SatyadarshiPosted Nov 8, 2012, 12:25 AM
Its good to use this concept in developing a secure application.