Whenever I enable "Enhanced User Interface" in the Theme settings, my installations fail with SQL Errors during the InstallExecute sequence. If I disable Enhanced UI, the SQL Scripts execute as expected. I've tracked this down to the errors always being around where text replacements are supposed to have occurred. It looks like when Enhanced UI is used, it always replaces the text in the SQL script with an empty string.
I believe this may be related to issues others have reported where certain properties are not being passed to the execute sequence. In my case, these are properties set by a custom action I have written. The custom action, which executes during the UI Sequence, takes user input values (like SQL Database Name) and quotes them to be safely inserted into SQL scripts (i.e. DbName becomes [DbName], and "Database's Value" becomes "'Database''s Value'").
To reproduce this:
1) Create a new installer with a Dialog that prompts for SQL Connection Information
2) On the 'Next' button, execute a custom action which quotes the DATABASE_NAME name property into DATABASE_NAME_IDENTIFIER (Changes 'DatabaseName' to '[DatabaseName]'; I had to write a DLL for this)
3) Add a SQL Server connection and SQL Script "use $(DATABASE_NAME_IDENTIFIER)"
4) Add a text replacement to the script to replace $(DATABASE_NAME_IDENTIFIER) with [DATABASE_NAME_IDENTIFIER]
5) Enable the Enhanced User Interface
6) Run the install
You should get a SQL Error stating "Invalid syntax near 'use'"
If you disable Enhanced User Interface (and undo all the automatic changes it did), the script will execute without any errors.