My textbook says, that across a battery or a cell there should be a potential drop equal to its e.m.f.
To be clear, you textbook is referring the potential measured across the battery terminals without any circuit connected to the terminals, i.e., the no load or open circuit potential across the terminals.
Now I've also learnt from sites that the potential at all points connected by a wire (or simply a conductor) remains same.
That would only apply if there was no resistance in the wire or conductor. With the exception of superconductors all wires and conductors have some resistance.
Now consider any point on the wire and it is connected with the part having 9 v (with the positive terminal) and the 0 v part (the side close to negative terminal). This means that particular point must have both 9 v and 0 v at the same time instant.
Now you are assuming that both the wire has no resistance and the battery has no resistance. All real batteries have internal resistance. When current is drawn by the wire there will be voltage drop across the battery's internal resistance, so the voltage across the battery terminals will equal the battery emf (no load voltage) minus the voltage drop across the internal resistance.
How do I solve this confusion?
You solve the confusion when you realize that no conductor (except superconductors) has zero resistance and no battery is an ideal voltage source (a source having zero internal resistance).
You said that a voltage equals e.m.f only when there is no current flowing . But according to Ohms law, V = IR. If I=0 then V=0 .How does pd exist then
Re-write Ohm's law as
$$I=\frac{V}{R}$$
Now think about the 9 V battery terminals not connected to anything. It's the equivalent as connecting a resistor across the terminals where the value of the resistance is infinite, or $R = ∞$. Then we have
$$I=\frac{emf}{∞}= \frac{9}{∞}=0$$
Hope this helps.