• sys.dm_exec_query_stats

    Returns aggregate performance statistics for cached query plans in SQL Server 2012. The view contains one row per query statement within the cached plan, and the lifetime of the rows are tied to the plan itself. When a plan is removed from the cache, the corresponding rows are eliminated from this view.

    There's no set retention. It depends on memory pressure and how many other queries are executed as to when it will get pushed out of the plan cache.