I have a game object which spins in all the axes when i click on a plane. I want the object to stop from spinning on the Y axis because I am making a 2D game. Please give your valuable response as soon as possible. The code is...

function Update()
{

// Look at and dampen the rotation

    var rotation = Quaternion.LookRotation(target.position - transform.position);
    transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime*damping);
}

Please help me soon. Thank you.

The beauty of a Quaternion is that it will rotate on all axes to take the shortest rotational path from A to B. If you don't want rotation in an axis, you should just use transform.Rotate or change the eulerAngles directly.

Maybe this is helpful http://unity3d.com/support/documentation/ScriptReference/Vector3.RotateTowards.html