Lots of things to consider here, environment, situations, people around you who can help you with the training sessions and so on.
Around the house you can start by:
Making sure you get his attention with treats, when there are kids or exciting stuff (for him) happening outside I believe that it's a good idea to reinforce him into a calm state where he doesn't prance around or whines, where you get his attention inside the house and reward him with a treat once he sits down. I would repeat this one or two times per day or every change you get to see him whine when distracting stuff is going on outside.
You can then raise the training level by making him not just sit, but also lay down, and make sure that he calms down a bit before you reward him for his calm state. You need to be able to walk around a bit and make sure he "stays" there, reward his staying behavior as well with a treat and a click. Repeat this for a few days same as with the first point above.
Last but not least, if the dog's bed or kennel is around the area you may also make him calm down first while in the trouble area while kids are playing, once he's calm and he got a treat you can extend the training a bit (if you wish) and reward him if he goes to the kennel or simply lays down in one of his spots in calms down on his own, it's further rewarding his calm behavior, not just on the spot, but also on his own choice if calming down and going to his favorite spot to lay down or be calm if it's what you desire... or maybe he will simply start to ignore those outside distractions.
With all kind of training with dogs it just requires patience, practice, consistency... do this for a few days, maybe dedicate 10 minutes to each session where he starts to whine, don't get frustrated if the behavior doesn't go away on the fly, it might take a couple of sessions, as long as you get him to calm down once or twice per session the number of times you need to calm him down will reduce over time for sure.
Outside the house but still in your property:
- If your dog whines when you leave it alone outside, it may be scratching the door, crying, barking or what not, in hopes that you have a front door and back door in your house you can get someone to tell him to "stop" or "be quiet" while you circle around to confront him so the door never opens until he's calm. By the time you'll get there and start to correct the behavior (in your own way of handling that) you can reward with a treat and a click and simply go in through the door without letting him in. Repeat this process with the same recommendations as the approach described above (10 mins or so a day for a couple of days).
Eventually the dog will stop his whining around the house when left outside or when he's inside the property and there's commotion outside.
You will notice that by the time you take your training to a public area such as the store how you describe you will have a much calmer dog that will probably won't need a lot of effort because you will notice that the dog will most likely be calm because of the behaviors he learned while being in the house.
...And Yes, there's a lot of new distractions to deal with when he's outside and it might be an issue or it might not, depends on your dog's temper and energy level, just remember that the more you can correct things at home in a more controlled environment the easier it will be do take charge in public areas.
And just in case for public areas:
You can start to determine if the bad behavior is cause by "you" the master leaving his sight by having someone stay outside with him for a bit to see how he reacts to you leaving.
You can also see if there's anything specific that freaks him out outside when left alone.
These two things (and more) can be determined much faster once your dog does the home training at first, and once you determine what the cause of him freaking out might be (if any still) when he's left outside in a public area and start to train again in the house by paying close attention to what triggers his behavior and coming up with a simple way of correcting it.
In example:
- If the dog is reacting bad when you leave and not when everyone leaves then you can train him by doing the distance thing when you make him "stay" and you take a few steps back, and continue going back until he gets up to follow. Once he does that you tell him to go back where you told him to stay and continue making more distance and coming back to rewarding him based on the milestones he's covering with more and more distance, you can do this in the same room, from room to room, from floor to floor, etc... he should be there staying and waiting for you until you come back, correct him right away if he gets up and runs towards you, he needs to wait there until you call him or release him from his stay command.
Like I said, lots of things to consider here, but I think that my answer is hopefully wide enough to cover your question and I wish you all the best with the training, it's just patience, patience and consistency.
Let me know if I missed anything and I'll be glad to edit my answer, cheers.