Here is solution with OpenRowSet. You only have to put all your work with temp table in dynamic sql (or you can use global temp table)
declare @Query nvarchar(max)
set @Query =
'
select 1 as FirstColumn, ''Hello'' as SecondColumn, GetDate() as ThirdColumn
union
select 2 as FirstColumn, ''world'' as SecondColumn, GetDate() as ThirdColumn
'
execute(@Query)
declare @sql nvarchar(max)
set @sql =
'
select * into #MyTempTable
from OPENROWSET(''SQLNCLI'', ''Server=(local);Trusted_Connection=yes;'', '''+ Replace(@Query, '''', '''''') +''')
select * from #MyTempTable
'
exec sp_executeSQL @sql
-- global table example
set @sql =
'
select * into ##MyTempTableGlobal
from OPENROWSET(''SQLNCLI'', ''Server=(local);Trusted_Connection=yes;'', '''+ Replace(@Query, '''', '''''') +''')
'
exec sp_executeSQL @sql
select * from ##MyTempTableGlobal