Handle last use value for different scenarios

What’s the best way to keep track of last name column value in the following scenario.

I have a name column in one of the table of MS SQL server where I want the first entry is A-1 which comes after user submits a record from the user interface. User has an option to select A, or B or C. If user selects A, then there is a name text fied in the user interface and I want to populate it as A-1and then we will haveA-1in the database. NExt time if they seectAagain, I want to prefill the name text input field withA-2` instead of having them type this name.

Same scenario, I need to follow for B and C as well so that I can prefil the input text field with B-1 or C-1 depending upon if they select B or C.

Is there a way I can add a field in the database table like lastUsed and get the next possible value based on user’s selection?

Closing as duplicate of How to handle last generated value issue!