by Al Beecy
January 22, 2009
Here is an example of how to encrypt a SQL Server stored procedure. Before doing this, make sure your unencrypted version is stored in source control or somewhere else safe because once created with the "WITH ENCRYPTION" feature, you will no longer be able to access the version stored in SQL Server.
CREATE PROCEDURE dbo.MyStoredProcedure
WITH ENCRYPTION
AS
BEGIN
SELECT 'my data'
END
Applies to: SQL Server 2005/2008