CREATE PROCEDURE [ProcedureName]
(
@CurrentIndex int,
@PageSize int
)
AS
SELECT * FROM(
SELECT ROW_NUMBER() over(order by ProductID) AS RowId,
Product_Name
FROM Products
)a
WHERE RowId BETWEEN (@CurrentIndex -1) * @TotalPageSize+ 1
AND (@CurrentIndex
* @TotalPageSize )