fixing issue in sql server 2012 with temp table ordering.