title: DecryptByKey returns null SQL Server 2012
body: <p>I am trying to decryptbykey and it returns null.</p>
  
  <pre><code>--CREATE MASTER KEY ENCRYPTION
  --BY PASSWORD = 'Password1'
  
  --CREATE CERTIFICATE MyCert
  --WITH SUBJECT = 'MyCert'
  
  --CREATE SYMMETRIC KEY MyKey
  --WITH ALGORITHM = TRIPLE_DES ENCRYPTION
  --BY CERTIFICATE MyKey
  
  OPEN SYMMETRIC KEY MyKey DECRYPTION
  BY CERTIFICATE MyCert;
  
  INSERT INTO sometable (ENCRYPTBYKEY(KEY_GUID('MyKey'),'12345'));
  
  CLOSE SYMMETRIC KEY MyKey;
  
  OPEN SYMMETRIC KEY MyKey DECRYPTION
  BY CERTIFICATE MyCert;
  
  SELECT
      CONVERT(VARCHAR(50), DECRYPTBYKEY(some_column))
  FROM sometable;
  
  CLOSE SYMMETRIC KEY MyKey;
  </code></pre>
  
  <p>The column is defined as varbinary(256).</p>
  
  <p>The result is null.  How do I change this to get the decrypted value instead of null?  Or what are some of the possible pitfalls or things to check?</p>