If you saved the query it will be on your local station somewhere with a .sql file extension. I think the default location would be C:\Users\\Documents\SQL Server Management Studio\Projects. As Lmu92 points out if you did not save the query it is probably gone.
If you ran the query against the database and have not restarted the SQL instance you may be able to recover it from the cache with this query.
SELECT deqs.last_execution_time AS [Time],
dest.TEXT AS [Query]
FROM sys.dm_exec_query_stats AS deqs
CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
ORDER BY deqs.last_execution_time DESC
0
solved Where can I find the main query?