Their are many ways to tech any obedience command. If a dog is not sitting reliably on command then it may be helpful to try one of the following tricks.
Younger dogs tend to be more food motivated, so find a treat they really love; give them a little taste. With the dog in front of you ask them to sit while showing the food, give them a moment and take a slight step forward while repeating the command. Do not take a large step just enough to close the space between you and do not take very fast steps, the dog may move away. One you have put pressure on the dog’s space they will submit by sitting. It may take a few tries for them to sit but as soon as they do give them the reward and shower them with praise.
If a dog is not food motivated, you can try energy commitment. This technique consists of using a leash and a collar attached to your dog to lead them in circles around your body as you spin. These circles can be fast or slow depending on the amount of energy the dog has, followed by an abrupt stop where the trainer stands in front of the dog invading their space and gives the command. This sudden stop takes the dog from being focused on the circles to now being focused on you. As soon as they sit and look at you give them immediate praise, and lots of it.