Wireless sensor network plays a major role in recent scientific developments for transmission of information. It comprises of many sensor nodes which are connected virtually to transmit and receive data. But security is the main challenge experienced in the WSN to have a proper data transmission. Hence detection and separation of the attacks created in the sensor network is necessary. In this paper, a scheme for intrusion detection in wireless sensor network is introduced. It is done by using a modified AdhocOn Demand Distance Vector (AODV) algorithm as a routing protocol. Here NS-2 is used for implementing and simulating the proposed protocol and its performance is evaluated and analysed considering various network parameters.