This study examined the performance and generalization ability of the SynBERT, a deep learning model, in SQL injection detection based on classification metrics such as accuracy, precision,recall, and F1- score. The study analysed the latest literature, conducted a quasi-experimentby training the SynBERT on three datasets, and evaluated its performance and generalizability across different scenarios. Three publicly available datasets containing malicious SQL injections, benign SQL queries, and plain text were selected to ensure diverse, high-quality data for training and evaluating the SynBERT model. The results showed that the choice of training dataset had a significant impact on the SynBERT models’ classification performance and generalization ability for SQL injection detection. In particular, the SynBERT trained on Dataset_A consistently achieved the best overall results. The statistical significance of the results was confirmed by confidence interval analysis and McNemar’s test. By improving the understanding of how training data influence model robustness, this study contributes to the development of more reliable AI driven security systems, helping to better protect digital systems from SQL injection attacks.