Detection of malware has become more challenging today because of the advancements and technologies adapted to corrupt the network or the devices. Static, dynamic and hybrid malware detection analysis methods have failed to provide complete malware detection. Hence in this work, a bio inspired sequence alignment method used in bioinformatics to compare the similarity between amino acid sequences in protein structures has been adapted to give the best similarity score to detect malwares. The state of art sequence alignment methods like Smith Water Man Algorithm (SWMA) used in bio informatics suffers from the problem of more memory utilization and computation time which is in the order of n2 ie., (O(n2)) and hence in this work an efficient sequence alignment algorithm (ESSA) has been proposed to address the problem of memory utilization thereby making the memory utilization and computation time to the order of n ie., (O(n)) there by making the detection rate higher. It is also clear from the results that the similarity score is high when the sequence length is small. The accuracy of the prediction rate of malware and benign increases.