Update a table in a stored procedure
<p>I have a stored procedure that has parameters. If I pass the parameter, the query is to update the table by the <code>LocationID</code>. </p>

<p>The stored procedure is as follows:</p>

<pre><code>CREATE proc [Location].[SPUpadtelocation_by_locationID]
    @Name       nvarchar(100),
    @Parentcode nvarchar(10),
    @CLientcode nvarchar(10),
    @Address    nvarchar(100),
    @city       nvarchar(20),
    @state      nvarchar(20),
    @Pin        int,
    @Clientid   int,
    @Status     bit,
    @Fax        int,
    @CreatedAt  date,
    @AccessAt   datetime,
    @Accessby   int,
    @LocationID int 
as
begin 
     if (select LocationID 
         from Location.tbl_Locationmaster 
         where Parentcode = @Parentcode 
           and Clientcode = @Clientcode  
           and Clientid = @Clientid) = @LocationID --check Location allready exists or not 
     begin 
         UPDATE [Location].[tbl_Locationmaster]
         SET [Name] = @Name,
             [Parentcode] = @Parentcode,
             [Clientcode] = @CLientcode,
             [Address] = @Address,
             [City] = @city,
             [State] = @state, 
             [Pin] = @Pin,
             [Clientid] = @Clientid, 
             [Status] = @Status,
             [Fax] = @Fax,
             [AccessAt] = getdate(),
             [Accessby] = @Accessby
         WHERE 
             LocationID = @LocationID
     end
end
GO
</code></pre>

<p>I don't want to update the <code>Name</code> column, <code>ParentCode</code> column and <code>ClientCode</code> column of <code>Location</code> table if the <code>Parentcode</code> and the <code>Clientcode</code> are already in the table for same <code>Client</code>. But the rest of the column should be updated.</p>