• Not sure you've gained anything.

    select ... convert(varchar(16), DecryptByKeyAutoCert(cert_id('MyCert'),

    But now, isn't the key actually "MyCert"? If somebody were clandestinely querying your database, all they'd need to figure out is "MyCert" which is visible in the stored procedure.

    [font="Arial"]Halfbubble ------------
    You just can't do this stuff unless you're at least half a bubble off center.[/font]