Ticking Sound Only When Accelerating

It does not make the ticking sound when I am at a complete stop and the car is in drive. I did speak to the dealer and although they have not looked at the engine yet, they just asked me if the spark plugs have been changed and that they would clean out the combustion chambers. I will switch to premium gasoline and see if this helps. I have been using regular for the past 2 years after the car was given to me from my father.