To be safe, you should add brackets around the table name in bitbucket's code.
Also, I strongly suggest using an alias on the table name instead of repeating the full table name throughout the query.
So:
SET @sSQL = 'SELECT t1.Funder, t1.[Facility ID] FROM ' +
'[' + @tablename + '] AS t1'
PRINT @sSQL
Scott Pletcher, SQL Server MVP 2008-2010