Issue of redirecting the web page to drug store

My developer has analysed and the report says that, main server of the website may be hacked because some of website innerpages redirecting the web page to drug store.
When we are looking website from user end it is loading normal page. But when we are seeing from cache:website it shows adult related words in footer and top of website.Please help me solve this issue.