I have been using a lot of pikemen lately in my battles. Usually, pikemen are only good against cavalry. In other cases - they loose in approx 70% situations that would be won by heavy infantry.

However, if they manage to use their pikes properly, they kill everyone and everything.

Two main reasons why they fail:

1) They switch to their swords (battle lost, because they are terrible with swords)

2) They hold the enemy using spear wall, but do almost no casualties (they simply stand and hold them, until their defence is broken.

you can resolve the first problem by switching guard mode on, but that gives you the second problem.

I usually switch between modes quickly, to find the best option for the situation.

Combined units of pikemen + another unit work very well.
For some strange reason, pikemen will fight more actively, if there is some fighting in front of them already. If there is 1000 enemies in front of them, they will do nothing. If thousand enemies attack a unit of swordmen, who march through pikemen lines, pikemen will start fighting perfectly with their pikes, not using sword.
There is variations for this strategy. I wrote somewhere, that I use formations of musketeers, stationed closely in front of pikemen, thus being protected by pikes. In a case of attack, pikemen fight perfectly, because there a is friendly units in the range of their pikes, who is being attacked.
Another way (for offensive tactics): Pikemen unit, which advances through standing unit of pikemen. Almost unmatched tactic, because, if the marching unit is forced to switch to the swords, they will still be protected by the pikes of the standing unit, which has a perfect formation + the standing unit will fight actively even on the guard mode (see previous paragraph) + the density of pikes from 2 units make it near impossible to beat them in frontal assault.

I especially concentrate on the tactics of pikemen in "guard mode", because the standard mode makes them slowly move forward during a melee fight, although there is no need for it, as their pikes allow to attack from a great range. This results in switching to alternative weapons (swords).

By the way, removing the secondary attack for pike units makes them work better (they use pikes, because they have no swords to switch to). But I have only tried it in few battles in vanilla M2:TW, so correct me if I am wrong.