That was really helpfull.
I was trying to execute on SQL Server 2008 R2 and bumped into an issue with the Collation parameters with the "keycolumns ".
To work around, I added COLLATE DATABASE_DEFAULT for keycolumns in the sections that generates the CREATE INDEX scripts.