Short answer: Yes, you can defeat pike formation. The longer answer is a bit more complex.
As anything in warfare, pike squares or pike formation was conceived and deployed to counter a very specific threat: Namely the cavalry charge. A disciplined body of troops in a shield wall with spears, and later a pike square, can take and repel a cavalry charge.
The problem is, a pike wall is only good against a cavalry charge. Granted, armored cav was like the tanks of the day, and it represented a major threat on the battlefield, but smart commanders could - and did - manage to find ways to destroy them.
A classic example would be the Battle of Cynoscephalae fought in 197BC between a Macedonian army made up mainly of phalangites and the modernized Roman Republic army of legionnaires and their allies. While a full discussion of the battle itself is outside the purview of this answer (and is available at the link), the battle demonstrated the pike square/shield wall's major weakness: They were almost impossible to maneuver. A phalanx is oriented forward and can advance only forward. It depends on light infantry and cavalry to protect its flanks are rear. Any commander that manages to drive off the cavalry and light infantry can basically attack the flanks and rear with impunity because that phalanx isn't going to turn to defend itself. In Cynoscephalae, the Roman legion also managed to take the Macedonian spears on their scutums and closed with the phalanx into gladius range - which the Macedonian phalangites with their small shields and tight formation weren't able to counter.
A medieval pike square was a little better because it was a square. It could repel attacks from four directions. The problem with them was that they didn't move. They couldn't. The strength of the square depended on its ability to ground their spears. Again, this was a formation that was dependent on combined arms to succeed: They needed the cavalry to drive off enemy infantry and archers. The example above from the battle of Falkirk is a good starting point. By the late 15th century, however, plate armor made an appearance and was developed well enough that pikemen in Munition armor could shrug off arrow hits. (Yes, contrary to popular myth, longbow arrows didn't really penetrate plate armor - which was designed specifically to counter this threat. Thus longbowmen fired at close against armored targets and the shots were taken mostly for their blunt concussive hits more than anything else).
Thus without gunpowder, the easiest way to break apart a pike square is to hit it with artillery. Ballistas and catapults could be quickly assembled in in the field, and pike squares are fat, juicy targets for them. Of course, then you'd have to protect your artillery with your own infantry and cavalry, and also engage their cavalry and light infantry. Once they break and run, you slaughter them.
Also, disciplined cavalry sometimes did manage to penetrate and disrupt enemy squares. Trained warhorses/destriers will charge a pike wall. If your heavy cavalry is disciplined and skilled enough, and the enemy pike square isn't as disciplined and skilled, you can charge your cavalry in and destroy them.