With most of the dogs, the behavior begins at the age of 3 to 6 months, before reaching sexual maturity. Early separation from the mother and the mother’s poor care of the puppy may be predispose for the stereotypic behavior.
Obsessive dogs will engage in repetitive behaviours, e.g. tail chasing, compulsively pacing, fence running, licking legs, etc. These behaviours are mostly triggered by boredom, in some cases they may be triggered by separation anxiety. The behaviour does not serve the dog and can even be harmful. You urgently need to consult a behaviourist and vet.
Before giving your canine drugs, consider a complementary naturopathic behavior therapy. Flower Remedies or Phytotherapy, Homoeopathy and others may help.