Increment each row according to condition in SQL C#
You can use a window function to calculate the rolling sum (of stock_in_hand) in a derived table or a CTE and then use that to update the table accordingly:

WITH upd AS
  ( SELECT 
        [Bill No],
        Item_Name,
        Stock_in,
        Stock_out,
        stock_in_hand,
        sum_stock = COALESCE(
            SUM(stock_in_hand) OVER (ORDER BY Item_Name, [Bill No]
                                     ROWS BETWEEN UNBOUNDED PRECEDING
                                              AND 1 PRECEDING)
            , 0) 
    FROM
        stock_recieve
  )
UPDATE upd
SET Stock_out = Stock_out
        + CASE WHEN 100 - sum_stock &gt;= stock_in_hand
              THEN stock_in_hand
              ELSE 100 - sum_stock
          END,
    stock_in_hand = stock_in_hand
        - CASE WHEN 100 - sum_stock &gt;= stock_in_hand
              THEN stock_in_hand
              ELSE 100 - sum_stock
          END 
WHERE sum_stock &lt; 100 ;