I have an Indian Passport and am travelling from Berlin to Dubai with Turkish airlines and have to change the airports in turkey. Do I need a visa for that?
You are entering the country so yes you need a visa, but. Turkey has an eVisa. Are you eligible? Wikipedia has you covered:
Citizens of these countries and territories are also eligible under certain conditions to apply for a single entry e-Visa on which they can stay for up to 30 days
India is included.
Now let's see the conditions:
All citizens except for the citizens of Gabon and Zambia, must hold a valid visa or residence from one of the following countries Schengen Countries, USA, UK or Ireland (except electronic visas).
If you are coming from Germany you surely have a Schengen visa.
All citizens except for the citizens of Afghanistan, Bangladesh, Egypt, India,
OK I cut this off because you are a citizen of India it doesn't apply
Must hold a hotel reservation and adequate financial means (US$50 per day)
Well, you are spending 0 days.
So: go ahead and apply for an eVisa.