Check out example codes for "sql server 2012 query history". It will help you in understanding the concepts better.

Code Example 1

SELECT t.[text]
FROM sys.dm_exec_cached_plans AS p
CROSS APPLY sys.dm_exec_sql_text(p.plan_handle) AS t
WHERE t.[text] LIKE N'%something unique about your query%';

Learn ReactJs, React Native from akashmittal.com