To determine which version of SQL Server is running.
SELECT @@VERSION AS 'SQL Server Version';
This query returns detailed information about the SQL Server instance, including the version, edition, and operating system it is running on.
Result
Microsoft SQL Server 2019 (RTM-CU14) (KB5007182) - 15.0.4188.2 (X64) Nov 3 2021 19:19:51 Copyright (C) 2019 Microsoft Corporation Developer Edition (64-bit) on Windows Server 2019 Standard 10.0 <X64> (Build 17763: ) (Hypervisor).