
-- Use the Demo database
USE [DataEncryptDemo]
go

-- Create the DB master key. 
-- Notice that the password may be subject to password policy verification, depending on your system.
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'DB Master key password!'
go
-- MASTER KEY CREATED

-- In this scenario, let's protect the symmetric with a certificate
CREATE CERTIFICATE [cert_SecretTable_SecretData_Key] 
  WITH SUBJECT = 'SecretTable_SecretData_Key protection'
go
-- You can also use other encryption algorithms like AES_128 if your system supports it
CREATE SYMMETRIC KEY [SecretTable_SecretData_Key] 
  WITH ALGORITHM = TRIPLE_DES 
  ENCRYPTION BY CERTIFICATE [cert_SecretTable_SecretData_Key]
go