Hello Saish !
Thank you for posting on Microsoft Learn.
You can use @@VERSION to check for Synapse-specific identifiers
SELECT @@VERSION AS VersionInfo;
Azure Synapse Dedicated SQL Pool will return something like:
Microsoft SQL Azure (RTM) - ...
PDW (APS) returns something closer to:
Microsoft SQL Server 2016 (SP2) (Analytics Platform System) ...
You can parse this result with a LIKE condition:
SELECT
CASE
WHEN @@VERSION LIKE '%Azure%' THEN 'Azure Synapse Dedicated SQL Pool'
WHEN @@VERSION LIKE '%Analytics Platform System%' THEN 'PDW / APS'
ELSE 'Unknown'
END AS EnvironmentType;
The availability or behavior of certain DMVs may differ. For example:
SELECT TOP 1 type FROM sys.dm_pdw_nodes;
This DMV exists on both, but in Azure Synapse, the type column usually shows 'COMPUTE', 'CONTROL' so you could do a combination of such checks.