Take the 2-minute tour ×  Every time I create a query and run it
to create a report I save the query in my Projects folder in
case I have to rerun the query in the future or if I have to
modify it for any reason but it seems that for some reason a
query which I ran sometime in mid June was not saved. I need to
see the code I used in the query because I am looking at the
report and some numbers do not look right so I need to check the
query to see if there was something written incorrectly in the
code.  Is there anyway in some logs maybe where I might be able
to see the code for the query I ran (and did not save) back in
June? This would be AWSOME if I can. Thanks!  share|improve this
question  2 Answers 2  up vote 6 down vote accepted  If your SQL
Server has not been restarted there may a chance that your query
text might have have been cached along with its execution plan.
You may want to run the following to see if query text is still
in the plan.      cp.objtype AS ObjectType,
OBJECT_NAME(st.objectid,s