• OK, here is the really really simple guide to how to do it:-

    First create a certificate, access to which represents permission to decrypt the SSN column; lets call it SSN_Cert.

    Then create a symmetric key to do the encryption and decryption with; lets call it SSNKEY.

    Let's pretend you have only two columns in your table just to make the example nice and simple;

    the columns are called full_name and encodedSSN and the table is called Name_and_SSN

    before you insert or read or update an encrypted SSN you open the key:-

    OPEN SYMMETRIC KEY SSNKEY DECRYPTION BY CERTIFICATE SSN_Cert;

    once you have the key opened, with the name and the SSN in variables @name and @ssn you can

    insert into the table by

    INSERT Name_and_SSN(full_name,encodedSSN)

    values(@name, EncryptByKey(Key_GUID('SSNKEY'), convert(varbinary(128), @ssn)));

    update an SSN by

    UPDATE Name_and_SSN

    SET encodedSSN = EncryptByKey(Key_GUID('SSNKEY'), convert(varbinary(128), @ssn))

    where full_name = @name;

    read and decrypt an SSN by

    SELECT CONVERT(varchar(128), DecryptByKey(encodedSSN)) as Plaintext_SSN

    FROM SSN_CERT where full_name = @name;

    edit: don't forget that you must give only people who should be able to see the SSNs access to the certificate. And that all insertions and updates to that column have to use the encryption function.

    Tom