is it okay to pre-check the data in T-SQL before execute the statement
<p>while I was working in the stored procedure to avoid the sting query in the server side, I came up with a question "why don't I validate the incoming data before executing the statement?" just before I go further with my work  I decided to ask this a question in Stack Overflow because there are highly professional members.</p>

<p>This is an example of the work </p>

<p>Ttable</p>

<pre><code>CREATE TABLE [dbo].[Ttable] (
    [TtableId]         INT            IDENTITY (1, 1) NOT NULL,
    [Ttablecol]        NVARCHAR (MAX) NOT NULL,
    [IsTtableIsActive] BIT            NOT NULL,
    PRIMARY KEY CLUSTERED ([TtableId] ASC)
);
</code></pre>

<p>example 1</p>

<pre><code>CREATE PROCEDURE [dbo].[spAddToTtable]
    @param NVARCHAR(MAX) = ''
AS
BEGIN
    IF(NOT EXISTS 
      (SELECT NULL 
       FROM   Ttable
       WHERE  Ttablecol = @param))
    BEGIN
    INSERT 
    INTO    Ttable(Ttablecol,IsTtableIsActive)
    VALUES  (@param,1)
    SELECT SCOPE_IDENTITY() AS INT 
    END
    ELSE
    BEGIN
        IF(EXISTS 
          (SELECT NULL 
           FROM   Ttable
           WHERE  Ttablecol = @param 
             AND  IsTtableIsActive = 0 ))
        BEGIN
            SELECT -2 AS INT 
        END
        ELSE
        BEGIN
            SELECT -1 AS INT
        END
    END
END
</code></pre>

<p>example 2</p>

<pre><code>CREATE PROCEDURE [dbo].[spInActiveTtable]
@param INT = 0
AS
BEGIN
    IF(EXISTS 
      (SELECT NULL 
       FROM   Ttable
       WHERE  IsTtableIsActive = 1))
    BEGIN
    UPDATE Ttable
    SET IsTtableIsActive = 0
    WHERE TtableId = @param
    SELECT SCOPE_IDENTITY() AS INT 
    END
    ELSE
    BEGIN
        IF(EXISTS 
          (SELECT NULL 
           FROM   Ttable
           WHERE  Ttablecol = @param 
             AND  IsTtableIsActive = 0 ))
        BEGIN
            SELECT -2 AS INT 
        END
        ELSE
        BEGIN
            SELECT -1 AS INT
        END
    END
END
</code></pre>

<p>example 3</p>

<pre><code>CREATE PROCEDURE [dbo].[spReActiveTtable]
@param INT = 0
AS
BEGIN
    IF(EXISTS 
      (SELECT NULL 
       FROM   Ttable
       WHERE  IsTtableIsActive = 0))
    BEGIN
    UPDATE Ttable
    SET IsTtableIsActive = 1
    WHERE TtableId = @param
    SELECT SCOPE_IDENTITY() AS INT 
    END
    ELSE
    BEGIN
        IF(EXISTS 
          (SELECT NULL 
           FROM   Ttable
           WHERE  Ttablecol = @param 
             AND  IsTtableIsActive = 1 ))
        BEGIN
            SELECT -3 AS INT 
        END
        ELSE
        BEGIN
            SELECT -1 AS INT
        END
    END
END
</code></pre>

<p>example 4</p>

<pre><code>CREATE PROCEDURE [dbo].[spModifyTtable]
@param INT = 0,
@param2 nvarchar(max) = ''
AS
BEGIN
    IF((SELECT  Ttablecol 
          FROM  Ttable
          WHERE TtableId = @param) = @param2)
          BEGIN 
          SELECT -5 AS INT 
          END 
    ELSE 
    BEGIN
    UPDATE  Ttable
    SET     Ttablecol = @param2
    SELECT -6 AS INT 
    END 
END
</code></pre>

<p>Is what I'm doing correct?</p>

<p>Thanks a lot for your help and I wish that my question is useful </p>