I don't really understand your problem. What does this have to do with the ID? The ID is just an internal marker for the database itself. How do you establish the relationship between the ID and the product code? The two have nothing to do with each other...
It doesn't really matter what ID the data record of a product code has, the important thing is the product code itself. Or are you using the ID as the product code? In my opinion, that would be a design error in the SQL database.
You search the SQL database using queries. There, too, the ID of a data record only plays a subordinate role. It does not belong to the actual data record. Why search for the product code via the IDs?
Please try to explain your problem to me a little...