As we all know paging is probably the most common question asked on this forum. Yet, I&#039;ve got another problem and thats basically because of my lack of knowledge in Stored Procedures...<BR><BR>From 4guys we have this SP:<BR>-----------------------------------------------------------<BR><BR>CREATE PROCEDURE sp_PagedItems<BR> (<BR> @Page int,<BR> @RecsPerPage int<BR> )<BR>AS<BR><BR>SET NOCOUNT ON<BR><BR>CREATE TABLE #TempItems<BR>(<BR> ID int IDENTITY,<BR> Name varchar(50),<BR> Price currency<BR>)<BR><BR><BR>INSERT INTO #TempItems (Name, Price)<BR>SELECT Name,Price FROM tblItem ORDER BY Price<BR><BR>DECLARE @FirstRec int, @LastRec int<BR>SELECT @FirstRec = (@Page - 1) * @RecsPerPage<BR>SELECT @LastRec = (@Page * @RecsPerPage + 1)<BR><BR>SELECT *,<BR> MoreRecords = <BR> (<BR> SELECT COUNT(*) <BR> FROM #TempItems TI<BR> WHERE TI.ID &#062;= @LastRec<BR> ) <BR>FROM #TempItems<BR>WHERE ID &#062; @FirstRec AND ID &#060; @LastRec<BR><BR>SET NOCOUNT OFF<BR>-----------------------------------------------------------<BR><BR><BR>While this works nicely Im wondering how I could make this SP more dynamic. I.e. work with multiple databases and with n colums te return.<BR><BR>And yeah, there ya go. I have absolutely no idea on how to do this.<BR><BR>So basically I want to turn the SP into a dynamic SP which I can use on any database, any table, to return any amount of colums.<BR><BR>Could someone help me out or give me a few pointers on where to start looking? Can it be done, or should I use another method of handling this case. Any help (whatsoever) is ofcourse greatly appreciated... :-)