Error: Unclosed quotation mark after
You're missing the end quote, this should get you there.

WHILE (@7DaysEarlierPartitionIntegerId &lt;= @CurrentPartitionIntegerId)
    BEGIN
        Set @7DaysEarlierPartitionId 
            = CAST(@7DaysEarlierPartitionIntegerId AS char)
        set @sqlCommand 
            = 'Select * from ' 
              + quotename(@RequestUsage_Partition + @7DaysEarlierPartitionId)
              + 'where UserLogin like ''r2\rohit.kharade'''
        exec(@sqlCommand)
        set @7DaysEarlierPartitionIntegerId 
            = @7DaysEarlierPartitionIntegerId + 1
    END


I generally like to use CHAR(39) in place of multiple quotes, just to make code more readable 

WHILE (@7DaysEarlierPartitionIntegerId &lt;= @CurrentPartitionIntegerId)
    BEGIN
        Set @7DaysEarlierPartitionId 
            = CAST(@7DaysEarlierPartitionIntegerId AS char)
        set @sqlCommand 
            = 'Select * from ' 
              + quotename(@RequestUsage_Partition + @7DaysEarlierPartitionId)
              + 'where UserLogin like ' + CHAR(39) + 'r2\rohit.kharade' + CHAR(39)
        exec(@sqlCommand)
        set @7DaysEarlierPartitionIntegerId 
            = @7DaysEarlierPartitionIntegerId + 1
    END


Bonus thought, just as another, more readable version, you could also QUOTENAME

WHILE (@7DaysEarlierPartitionIntegerId &lt;= @CurrentPartitionIntegerId)
    BEGIN
        Set @7DaysEarlierPartitionId 
            = CAST(@7DaysEarlierPartitionIntegerId AS char)
        set @sqlCommand 
            = 'Select * from ' 
              + quotename(@RequestUsage_Partition + @7DaysEarlierPartitionId)
              + ' where UserLogin like ' + QUOTENAME('r2\rohit.kharade', CHAR(39))
        exec(@sqlCommand)
        set @7DaysEarlierPartitionIntegerId 
            = @7DaysEarlierPartitionIntegerId + 1
    END