'Use  ' statement not executing T-SQL
sp_executesql creates a new execution context which ceases to exist when the executed statements return.  The USE only has effect within the sp_executesql.  Try this 

SET @SQL02 = 'USE ['+ convert(nvarchar(50),@dbName) +']; SELECT DB_NAME();'


and you'll get what you're after.