The header in the EFI_SYSTEM_TABLE (gST) carries the UEFI Specification version. It is filled in by the DXE Core when it produces the EFI System Table.
$ git grep EFI_SYSTEM_TABLE_REVISION
MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c:126: EFI_SYSTEM_TABLE_REVISION, // Revision
MdeModulePkg/Universal/SetupBrowserDxe/Setup.h:74:#define EFI_IFR_SPECIFICATION_VERSION (UINT16) (((EFI_SYSTEM_TABLE_REVISION >> 16) << 8) | (((EFI_SYSTEM_TABLE_REVISION & 0xFFFF) / 10) << 4) | ((EFI_SYSTEM_TABLE_REVISION & 0xFFFF) % 10))
MdePkg/Include/Uefi/UefiSpec.h:1780:#define EFI_SYSTEM_TABLE_REVISION EFI_2_70_SYSTEM_TABLE_REVISION
MdePkg/Include/Uefi/UefiSpec.h:1781:#define EFI_SPECIFICATION_VERSION EFI_SYSTEM_TABLE_REVISION
$ git grep EFI_2_70_SYSTEM_TABLE_REVISION
MdePkg/Include/Uefi/UefiSpec.h:1769:#define EFI_2_70_SYSTEM_TABLE_REVISION ((2 << 16) | (70))
MdePkg/Include/Uefi/UefiSpec.h:1780:#define EFI_SYSTEM_TABLE_REVISION EFI_2_70_SYSTEM_TABLE_REVISION