• Hello, thanks for yours answers.
    The idea is that procedures return one row or all, simple idea for a simple example.
    The table is a simple and little table, with a real table the complexity is bigger.
    Procedure one, the developer can pass a value or not, when @id is null, it doesn't concat the clause while and return all rows; when is not null, return the row if exists because the code concatenated the clause while.
    Procedure two, the devoleper pass a value for @id and for @rows, because @rows will determinate the rows returned (one or all) and  it will return row(s) from the value passed in @id. When the value for @id is the first key in the table or a value lesser than all keys, it will return all rows.
    I always thought between procedure one and procedure two, compilations, recompilations and CPU cost was bigger in procedure one than procedure two.
    For that, whether I am not correct, i needed a opinion about this question.