You cannot prepare a child for it, because developmentally, the child cannot anticipate that kind of event. The words probably won't have any meaning.
I'd take the child to a sitter and then take the dog to the vet and have the experience with just you and your husband. If your child notices that you are upset before you leave, just explain that your dog is sick, and that makes you very sad.
Then, after you pick the child up from the sitter and get home, sit down with the child and simply say that the dog has died and that you are very sad. Fill in the details when he is older, like someday when he sees a picture of himself with the dog and asks you, "whatever happend to that dog, anyway?"
Please,DO NOT MENTION THE DOCTOR! The very idea that the dog would go to the doctor and not come home again is mortifying to a child! The idea of having a dog put down at the doctor's office is just too scary. He has no way of differenciating between animal doctors and people doctors right now, so don't even go there. Just say that the dog died. It is the truth, and the details are irrelevant to a 2 year old.
Concentrate on the feelings that come from missing the dog. If he is sad, just say that you are sad, too. Chances are, you and your husband are more upset about it than your son will be.
And, no words of explanation is going to make any sense to your son right now. He will probably ask for the dog several times in the coming weeks no matter what you say, and you'll just have to repeat that the dog has died.
Here is the only explanation of death that I have used for my kids when they were little that seemed to shed some understanding. I use a puppet as a prop. I either put it on my hand or on the child's (or both) Then I move the puppet around and make it talk, etc. And I ask them, "Why is the puppet moving? How is it talking, etc." and get the child's responses. Then I take the puppet off the hand and lay it down on the table. "Isn't the puppet moving and talking now? Why not?" and get the child's responses. Then say, "It was my hand (your hand) that made the puppet ALIVE! When I took my hand out, the puppet isn't alive anymore, right? Well, when we die, it is like when we take the hand out of the puppet. The part that made (the dog's name, the person's name) ALIVE is no longer there! (We believe that that is the spirit of a person, but if your beliefs are different, you can substitute that). When you take the spirit out, it is like taking your hand out of the puppet. The spirit goes on to do other things, just like when you take your hand out of the puppet, now your hand can do other things. The puppet's body is still there, but it isn't alive because his spirit is gone out. And that what it means to die."
Then if he has questions about WHY, I just simply explain that the body was too sick for the spirit anymore, and that is like when a puppet gets torn or broken or whatever, and the hand wants to go play other games. I'd only go into that explanation if they child asked, however. Or I'd do it on another occasion, like when I was repeating the explanation another time. I'd also get the child to explain it back to me, or to explain it to another person, like daddy or grandma, on another occasion as well. Such as when the child gets a real sad face and says something like, "Our dog died." and you say, "Yes, he did. What does that mean?" and let him explain it to you as he understands it.
I'd also concentrate on trying to comfort your husband and to try to be understanding of his greiving process...and that it is a process. Your son may or may not really greive himself, he may mimic what he sees in you and your husband.
I hope some of this helps,
L.