In Microsoft SQL Server, when you try to monitor cached query plans by using extended events (xEvents) and dynamic management views (DMVs), such as sys.dm_exec_requests and sys.dm_exec_query_stats, it is very difficult to correlate the cached query plans together.
This issue occurs because the data types of the Query_hash and Query_plan_hash columns differ between DMVs and xEvents. The Query_hash and Query_plan_hash columns are defined as Varbinary data type in DMVs (sys.dm_exec_requests and sys.dm_exec_query_stats). In xEvents, the columns are defined as UINT64 data type.
Service pack information for SQL Server
This update is fixed in the following service packs for SQL Server:
After you install this update, two additional columns defined as INT64 data type are added: Query_hash_signed and Query_plan_hash_signed. These make it easier to join data between the DMVs and xEvents (such as rpc_completed and sql_batch_completed).
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.