My problem is the version of script that is getting executed is not what i saved.
Well, if you added a Start-Transcript to your script, and you now see a transcript file being created, then the script that you are executing is the script that you updated. Because if you were executing some cached version, it would not include the Start-Transcript and the file would not get created.
Add output statements (which will appear in the transcript file) to display what you are looking at. You are probably doing a string comparison when you really want to do a numeric comparison.
$TestValue = 200
"Totalconn = {0} and I will test for {1}" -f $totalconn, $TestValue
"Totalconn is of type {0}" -f $totalconn.gettype().name
"Test is {0} " -f ($totalconn -gt $TestValue)
"Numeric test is {0} " -f ([int]$totalconn -gt $TestValue)
if([int]$totalconn -gt $TestValue){ # insure testing integers, not strings
send-mailmessage -To $Toaddr -From $fromaddr -Subject "Warning - $message - PLEASE CHECK" -Body $body -SmtpServer $smtpserver}