Skip to content

Instantly share code, notes, and snippets.

@jstangroome
jstangroome / DecryptObject.sql
Created November 5, 2012 21:29
Decrypt encrypted SQL Server stored procedures.
-- Must connect to SQL Server using the Dedicate Admin Connection, eg "admin:localhost". Verified with SQL Server 2012.
-- Originally from Williams Orellana's blog: http://williamsorellana.org/2012/02/decrypt-sql-stored-procedures/
DECLARE @ObjectOwnerOrSchema NVARCHAR(128)
DECLARE @ObjectName NVARCHAR(128)
SET @ObjectOwnerOrSchema = 'dbo'
SET @ObjectName = 'PROCEDURE NAME HERE'
DECLARE @i INT