title: How to apply a SQL statement to many SQL Server 2008 R2 databases?
body: <p>I have 4 machines running SQL Server 2008 R2 in VirtualBox, and each of the instances has 16 databases on them, with the name ending in an incremented number (1 - 16)... so <code>database1</code>, <code>database2</code>, <code>database3</code>, etc.</p>
  
  <p>All of these databases are clones of each other (same structure); we use them for parallel testing for a Rails project.</p>
  
  <p>I need to add two columns to a given table on all 64 databases. How can I accomplish this in an automated (or at least painless) fashion? Is there a way I can write a script or something in SQL Server to do this?</p>