Multiple Sclerosis (MS) is a Central Nervous System (CNS) disease that Magnetic Resonance Imaging (MRI) system can detect and segment its lesions. Artificial Neural Networks (ANNs) recently reached a noticeable performance in finding MS lesions from MRI. U-Net and Attention U-Net are two of the most successful ANNs in the field of MS lesion segmentation. In this work, we proposed a framework to segment MS lesions in Fluid-Attenuated Inversion Recovery (FLAIR) and T2 MRI images by modified U-Net and modified Attention U-Net. For this purpose, we developed some extra preprocessing on MRI scans, made modifications in the loss function of U-Net and Attention U-Net, and proposed using the union of FLAIR and T2 predictions to reach a better performance. Results show that the union of FLAIR and T2 predicted masks by the modified Attention U-Net reaches the performance of 82.30% in terms of Dice Similarity Coefficient (DSC) in the test dataset, which is a considerable improvement compared to the previous works.