SQL Flow Field Guide

KEY_GUID

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

cryptographic transform or key lookup

What changes

Input
plaintext or ciphertext and a key, certificate or passphrase
Output or change
ciphertext, plaintext, hash, signature check, or key metadata
Return type
uniqueidentifier

Syntax at a glance

Key_GUID( 'Key_Name' )

Work example

Resolve an existing symmetric key name to its key GUID.

Use synthetic data in an isolated database. Follow the existing key hierarchy and keep keys and plaintext out of output.

Check your work Check database context and permissions and do not expose key metadata beyond the review.

Open Microsoft Learn for full syntax, permissions, and details for your version.