If you see below and the name part is not in the lookup table, it will add to it automatically. I have included the script with the article for you to look into it.
Regards
CREATE procedure [dbo].[InsertNameValuePair]
@CustomerId int,
@Name nvarchar(100),
@value nvarchar(max)
as
set nocount on
declare @pairNameId smallint, @partitionId int
if exists (select top 1 PairNameId from dbo.PairNames where PairName like @Name)
begin
select @pairNameId = PairNameId
from dbo.PairNames where pairname = @Name
end
else
begin
insert into dbo.PairNames(PairName)
values (@Name)
select @pairNameId = scope_identity()
end
set @partitionId = @customerId%4 + 1
insert into nvp(CustomerId, partitionId, PairNameId, PairValue)
values (@customerId, @partitionId, @pairNameId, @value)
go