I've got a really simple dynamic using clause that doesn't work. In fact it causes the script to silently fail and so I'm guessing there is a security issue as SQL Server isn't reporting what is going on and whenever that happens its security.
declare @DatabaseName varchar(100)
declare @query1 nvarchar(500)
select @DatabaseName = 'mydb'
set @query1 = 'Use ' + @DatabaseName + ''
exec (@query1)
Deems simple, but it won't use 'mydb'.