On the given information I can say: it should work.
But I can't see what you are really doing.
Is this little test working for you?
declare @sql nvarchar(max)
set @sql = 'select ''Test'''
create table #sample (testcol varchar(255))
insert #sample
exec sp_executesql @sql with recompile
select * from #sample
drop table #sample
Too old to Rock'n'Roll too young to die.