DECRYPTBYASYMKEY (Transact-SQL)
Decrypts data with an asymmetric key.
The following example decrypts ciphertext that was encrypted with asymmetric key JanainaAsymKey02, which was stored in AdventureWorks.ProtectedData04. The returned data is decrypted using asymmetric key JanainaAsymKey02, which has been decrypted with password pGFD4bb925DGvbd2439587y. The plaintext is converted to type nvarchar.
SELECT CONVERT(nvarchar(max),
DecryptByAsymKey( AsymKey_Id('JanainaAsymKey02'),
ProtectedData, N'pGFD4bb925DGvbd2439587y' ))
AS DecryptedData
FROM [AdventureWorks].[Sales].[ProtectedData04]
WHERE Description = N'encrypted by asym key''JanainaAsymKey02''';
GO

