We can encrypt the stored procedures using “WITH ENCRYPTION”.After stored procedure name we have to write the “WITH ENCRYPTION”.
EXAMPLE:CREATE PROCEDURE spViewEmployees WITH ENCRYPTIONASBEGIN SELECT * FROM EmployeeEND
Then when you try to find the stored procedure text using the SysComments table text column is coming null.
SELECT * FROM SYSCOMMENTS WHERE ID = OBJECT_ID(‘spViewEmployees’)
In SQL Server, you can encrypt a stored procedure at the time you create it, or you can alter it later to include encryption. To create a stored procedure with T-SQL, you use the CREATE PROCEDURE syntax. To encrypt it, you add the WITH ENCRYPTION argument.