Looping through tables where the name increments monthly
Here is a quick solution

DECLARE @command VARCHAR(8000)
DECLARE @Date DATE = '2012-01-01'
DECLARE @Year SMALLINT
DECLARE @Month SMALLINT

WHILE @Date &lt;= '2013-06-30'
BEGIN
    SET @Year = Year(@Date)
    SET @Month = month(@Date)

    SET @command = '
  UPDATE customers
  SET Account_Number = 
        (SELECT Account_Number
         FROM Hist' + right('00' + convert(VARCHAR(2), @Month), 2) + '_' 
                    + right('00' + convert(VARCHAR(4), @Year), 2) + '
         WHERE Account_Number = customers.Account_Number
        )
  WHERE Account_Number = 0  
    AND Date &gt;= ''' + convert(varchar(10),@Date,120) + 
    ''' and &lt; ''' + convert(varchar(10),dateadd(month, 1, @Date),120) + 
  ''';'

    PRINT @command

    SET @date = dateadd(month, 1, @Date)
END