Coprophagia is the ingestion of feces. It was first believed that this behavior was caused by poor diet or poor health, but current research has discounted this. Dogs are historically scavengers, and coprophagia may be a scavenger behavior or they may learn this behavior from other dogs. In some dogs coprophagia is a way to get your attention, or it could be caused by anxiety or boredom.
The best way to correct coprophagia is to prevent access to fecal material. Keep the dog's yard and kennel clean.
When walking your dog, keep him/her on a leash.
Some dogs are attracted to cat litter boxes. For this, make the litterbox inaccessible by using a covered litterbox or place the box on an elevated surface. (Just be sure the cat can still get to it!)
Above all, do not punish your dog. There are some products available which will deter a dog from eating their own feces. For more information, contact your veterinarian.